<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="https://cdn.bootcss.com/echarts/4.2.0-rc.1/echarts-en.min.js"></script>
	</head>
	<body>
		<div id="main" style="width: 500px;height: 400px;"></div>
		<script type="text/javascript">
			//初始化echarts实例
			var myChart = echarts.init(document.querySelector("#main"));
			//指定图表的配置项和数据
			var option = {
				tooltip:{
					formatter:"{a}<br/>{b}:{c}%"
				},
				toolbox:{
					feature:{
						restore:{},
						saveAsImage:{}
					}
				},
				series:[
					{
						name:"业务指标",
						type:'gauge',
						detail:{formatter:function(params){
							console.log(params);
							return params
						}},
						data:[{value:32,name:"完成率"}]
					}
				]
			}
			//使用刚指定的 配置项和数据显示图标
			myChart.setOption(option);
			//动态修改数据指标的值
			setInterval(function(){
				option.series[0].data[0].value = (Math.random()*100).toFixed(2)-1;
				myChart.setOption(option);
			},2000)
			
		</script>
	</body>
</html>
